package com.lz.repository.xjl.impl;

import com.lz.entity.InstallationPerson;
import com.lz.repository.xjl.InstallationPersonDao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 徐建林
 * @date 2018/10/31 19:35
 */
@Repository
public class InstallationPersonDaoImpl implements InstallationPersonDao {
    @Autowired
    private SessionFactory sessionFactory;
    @Override
    public List<InstallationPerson> getInstallationPersonList() {
        Session session = sessionFactory.getCurrentSession();
        List<InstallationPerson> installationPersonList = session.createQuery("from InstallationPerson").list();
        return installationPersonList ;
    }
	@Override
	public InstallationPerson getPersonId(Integer id) {
		Session session = sessionFactory.getCurrentSession();
		return (InstallationPerson) session.get(InstallationPerson.class, id);
	}
}
